package com.yeswater.multithread.chapter1.test1_2.test1_2_10;

/**
 * author : yeswater
 * date : 2023/10/18
 */

public class MyThread extends Thread{

    private int i = 5;

    /**
     * i-- 放在 println 里面 也可能出现线程安全问题,因为 i--先于 println 执行,但是我没测出来...
     */
    @Override
    public void run() {
        i--;
        System.out.println("i = " + (i) + " thread name = " + currentThread().getName());
        // System.out.println("i = " + (i--) + " thread name = " + currentThread().getName());
    }
}
